package com.gupaoedu.vip.mongo.demo.dao;

import com.gupaoedu.vip.mongo.demo.entity.Member;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import javax.core.common.mongo.BaseDaoSupport;
import javax.core.common.mongo.QueryRule;
import java.util.List;

@Repository
public class MemberDao extends BaseDaoSupport<Member, ObjectId> {

    public List<Member> select(QueryRule queryRule) {
        return super.find(queryRule);
    }

    public int insertAll(List<Member> data) {
        return super.saveAll(data);
    }


    @Resource(name = "mongoTemplate")
    @Override
    protected void setMongoTemplate(MongoTemplate mongoTemplate) {
        super.setMongoTemplate(mongoTemplate);
    }

    @Override
    protected String getPKColumn() {
        return "_id";
    }
}
